Conditions | 2 |
Paths | 5 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict' |
||
9 | Kits.list = function (callback) { |
||
10 | if (Kits.cache.length) { |
||
11 | callback(Kits.cache) |
||
12 | return |
||
13 | } |
||
14 | |||
15 | var stopSpinner = util.output.wait('Loading available starter kits') |
||
16 | util.request('kits/short').end(function (response) { |
||
17 | if (response.error || !response.body) { |
||
18 | stopSpinner(response.error) |
||
19 | process.exit() |
||
20 | } |
||
21 | |||
22 | stopSpinner() |
||
23 | var list = response.body.data.sort(function (a, b) { |
||
24 | if (a === 'basic') { |
||
25 | return -1 |
||
26 | } |
||
27 | if (b === 'basic') { |
||
28 | return 1 |
||
29 | } |
||
30 | return a > b ? 1 : -1 |
||
31 | }) |
||
32 | |||
33 | Kits.cache = list |
||
34 | callback(list) |
||
35 | }) |
||
36 | } |
||
37 | |||
39 |